//
//  MailModel.m
//  UI17 - Mail-List
//
//  Created by 韩旭 on 16/8/5.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "MailModel.h"

@implementation MailModel
//赋值
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        _name = [aDecoder decodeObjectForKey:@"name"];
        _gender = [aDecoder decodeObjectForKey:@"gender"];
        _phoneNumber = [aDecoder decodeObjectForKey:@"phoneNumber"];
    }
    return self;
}
// 赋值
- (void)encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:_name forKey:@"name"];
    [aCoder encodeObject:_gender forKey:@"gender"];
    [aCoder encodeObject:_phoneNumber forKey:@"phoneNumber"];
}

- (instancetype)initWithDic:(NSDictionary *)dic {
    self = [super init];
    if (self) {
    [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}
+ (instancetype)mailModelWithDic:(NSDictionary *)dic {
    return [[MailModel alloc] initWithDic:dic];
}
+ (NSArray *)groupArray {
    NSMutableArray *arrDataSource = [NSMutableArray array];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"DLS160710(1)" ofType:@"plist"];
    NSArray *arrRoot = [NSArray arrayWithContentsOfFile:path];
    for (NSDictionary *dic in arrRoot) {
    [arrDataSource addObject:[MailModel mailModelWithDic:dic]];
    }
    return arrDataSource;
}
@end
